package DAO;

import entities.Coupon;
import java.math.BigDecimal;
import java.util.List;

import org.hibernate.Query;
import utils.HibernateUtil;

/**
 *
 * @author alex
 */
public class CouponDAO extends GenericDAOImpl<Coupon, BigDecimal> implements ICouponDAO {

    public Coupon findByCouponDeatils(String details) {
        Coupon coupon = null;
        String sql = "SELECT p FROM Coupon p WHERE p.details = :details";
        Query query = HibernateUtil.getSession().createQuery(sql).setParameter("details", details);
        coupon = findOne(query);
        return coupon;
    }


}
